/*
 * JGarminImgParser - A java library to parse .IMG Garmin map files.
 *
 * Copyright (C) 2007 Patrick Valsecchi
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package mapcontrol;

public class MapConfig implements Cloneable {

    private Quality quality = Quality.FINAL;
    private boolean showLineLabel = true;
    private boolean showPolygonLabel = true;
    private boolean showPointLabel = true;
    private int poiThreshold = 0xff;
    private int detailLevel = 0;
    private boolean showPavedRoads = true;
    private boolean showUnpavedRoads = true;
    private boolean showWaterLines = true;
    private boolean showTopoLines = true;
    private boolean showOtherLines = true;
    private boolean showPolygons = true;
    private boolean showCitiesAndTowns = true;
    private boolean showPOIs = true;

    public void setQuality(Quality quality) {
        this.quality = quality;
    }

    public Quality getQuality() {
        return quality;
    }

    public boolean equals(Object obj) {
        if (obj instanceof MapConfig) {
            MapConfig other = (MapConfig) obj;
            return quality == other.quality
                    && showLineLabel == other.showLineLabel
                    && showPolygonLabel == other.showPolygonLabel
                    && showPointLabel == other.showPointLabel
                    && poiThreshold == other.poiThreshold
                    && detailLevel == other.detailLevel
                    && showPavedRoads == other.showPavedRoads
                    && showUnpavedRoads == other.showUnpavedRoads
                    && showWaterLines == other.showWaterLines
                    && showTopoLines == other.showTopoLines
                    && showOtherLines == other.showOtherLines
                    && showPolygons == other.showPolygons
                    && showCitiesAndTowns == other.showCitiesAndTowns
                    && showPOIs == other.showPOIs;    
        }
        return false;
    }

    public void setShowLineLabel(boolean showLineLabel) {
        this.showLineLabel = showLineLabel;
    }

    public boolean isShowPolygonLabel() {
        return showPolygonLabel;
    }

    public void setShowPolygonLabel(boolean showPolygonLabel) {
        this.showPolygonLabel = showPolygonLabel;
    }

    public boolean isShowPointLabel() {
        return showPointLabel;
    }

    public void setShowPointLabel(boolean showPointLabel) {
        this.showPointLabel = showPointLabel;
    }

    public boolean isShowLineLabel() {
        return showLineLabel;
    }

    public int getPoiThreshold() {
        return poiThreshold;
    }

    public void setPoiThreshold(int poiThreshold) {
        this.poiThreshold = poiThreshold;
    }

    public void setDetailLevel(int detailLevel) {
        this.detailLevel = detailLevel;
    }

    public int getDetailLevel() {
        return detailLevel;
    }


    public boolean isShowCitiesAndTowns() {
        return showCitiesAndTowns;
    }

    public void setShowCitiesAndTowns(boolean showCitiesAndTowns) {
        this.showCitiesAndTowns = showCitiesAndTowns;
    }

    public boolean isShowOtherLines() {
        return showOtherLines;
    }

    public void setShowOtherLines(boolean showOtherLines) {
        this.showOtherLines = showOtherLines;
    }

    public boolean isShowPOIs() {
        return showPOIs;
    }

    public void setShowPOIs(boolean showPOIs) {
        this.showPOIs = showPOIs;
    }

    public boolean isShowPavedRoads() {
        return showPavedRoads;
    }

    public void setShowPavedRoads(boolean showPavedRoads) {
        this.showPavedRoads = showPavedRoads;
    }

    public boolean isShowPolygons() {
        return showPolygons;
    }

    public void setShowPolygons(boolean showPolygons) {
        this.showPolygons = showPolygons;
    }

    public boolean isShowTopoLines() {
        return showTopoLines;
    }

    public void setShowTopoLines(boolean showTopoLines) {
        this.showTopoLines = showTopoLines;
    }

    public boolean isShowUnpavedRoads() {
        return showUnpavedRoads;
    }

    public void setShowUnpavedRoads(boolean showUnpavedRoads) {
        this.showUnpavedRoads = showUnpavedRoads;
    }

    public boolean isShowWaterLines() {
        return showWaterLines;
    }

    public void setShowWaterLines(boolean showWaterLines) {
        this.showWaterLines = showWaterLines;
    }
    
    

    public enum Quality {

        TEMP, //no label, no aliasing
        DRAFT, //no aliasing
        FINAL       //all the fancy stuff
    }

    protected MapConfig clone() {
        try {
            return (MapConfig) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            return this;
        }
    }

    public String toString() {
        return "q=" + quality + " lineL=" + showLineLabel + " ptL=" + showPointLabel + " polL=" + showPolygonLabel + " ptT=" + poiThreshold + " detail=" + detailLevel;
    }
}
